/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.animation.transformations;

import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.api.Generator;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.helpergenerators.TransformGenerator;
import pl.edu.amu.wmi.kino.visualjavafx.javafxcodegenerators.helpergenerators.TransformParamChecker;
import pl.edu.amu.wmi.kino.visualjavafx.model.animation.transformations.Shear;

/**
 *
 * @author Admin
 */
public class SkewGenerator implements Generator{

    @Override
    public boolean canGenerate(Object c) {
        if(c instanceof Shear)
            return true;
        else return false;
    }
  
    @Override
    public void generate(StringBuilder sb, Object o,int recursionLevel,Object original) {
        this.generateSkewX(sb, (Shear)o,recursionLevel);
        this.generateSkewY(sb, (Shear)o,recursionLevel);
    }

    private void generateSkewX(StringBuilder sb,Shear s,int recursionLevel){
        
        if(TransformParamChecker.generateParam(s.getDestinedHShear()))
        sb.append(TransformGenerator.skewX+recursionLevel+" => "+s.getDestinedHShear()+
                " tween Interpolator."+s.getInterpolations()[0].getName()+",\n");
    }

    private void generateSkewY(StringBuilder sb,Shear s,int recursionLevel){
        
        if(TransformParamChecker.generateParam(s.getDestinedVShear()))
        sb.append(TransformGenerator.skewY+recursionLevel+" => "+s.getDestinedVShear()+" " +
                "tween Interpolator."+s.getInterpolations()[1].getName()+",\n");
    }

}
